package net.discard.util;

import org.apache.http.Header;

import java.io.Serializable;
import java.util.Arrays;

/**
 * Created by chenyan on 2016/11/20.
 * <p>
 * 给 HTTPClietnt 提供的参数类。用来接收 http 响应中，协议相关的信息。如状态码，响应头等。
 * <p>
 * 业务代码使用http做远程调用的方式，本不该关心http协议相关的内容，只应该关注responseBody。但是现有项目中有依赖状态码对responseBody做处理的逻辑。
 */
public class HTTPProtocolThings implements Serializable {

    private static final long serialVersionUID = 5811089593818622055L;

    private int statusCode;

    private Header[] responseHeaders;

    public HTTPProtocolThings() {
    }

    public int getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(int statusCode) {
        this.statusCode = statusCode;
    }

    public Header[] getResponseHeaders() {
        return responseHeaders;
    }

    public void setResponseHeaders(Header[] responseHeaders) {
        this.responseHeaders = responseHeaders;
    }

    @Override
    public String toString() {
        return "HTTPProtocolThings{" +
                "statusCode=" + statusCode +
                ", responseHeaders=" + Arrays.toString(responseHeaders) +
                '}';
    }
}
